/**
 * This class is designed to be used in both website and android.
 * <p/>
 * zhaoxu @ 2012-05-24 16:49
 * <p/>
 */
package com.threeti.mecool.core.domain.model.plan.pojo;

import org.codehaus.jackson.annotate.JsonBackReference;
import org.codehaus.jackson.annotate.JsonIgnore;

public class GroupStepItem {
	private Long id;
	private Integer version;
	private GroupStep groupStep;
	private Step nextStep;
	private transient Long nextStepId;

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	@JsonBackReference
	public GroupStep getGroupStep() {
		return groupStep;
	}

	public void setGroupStep(GroupStep groupStep) {
		this.groupStep = groupStep;
	}

	@JsonIgnore
	public Step getNextStep() {
		if (nextStep == null && nextStepId != null) {
			nextStep = groupStep.getJob().findStepById(nextStepId);
		}
		return nextStep;
	}

	public void setNextStep(Step nextStep) {
		this.nextStep = nextStep;
	}

	public Long getNextStepId() {
		if (nextStepId == null && nextStep != null) {
			nextStepId = nextStep.getId();
		}
		return nextStepId;
	}

	public void setNextStepId(Long nextStepId) {
		this.nextStepId = nextStepId;
	}


	public Integer getVersion() {
		return version;
	}

	
	public void setVersion(Integer version) {
		this.version = version;
	}
	
}
